*Author: Mitch Radtke
*Project: Why Kill Deposed Leaders? Regime Types and Post-Tenure Fates
*Date Last Modified: September 17, 2018

*Loading needed packages

sysdir set PLUS "F:\Stata12\ado\plus"
sysdir set PERSONAL "F:\Stata12\ado\personal"

*Opening up data [will need to change directory]

"F:\Mussolini\FPA RnR v2\Radtke_FPA_CrossSectional.dta"

*************************************************************************************
*TABLES*
*************************************************************************************
*Table 1 "Cross-Tabulation for Autocracy and Post-Tenure Fate"

tab punish gwf_autocracy, chi column

*Table 2 "Logit Models for Negative Fates (Geddes Regimes)"

logit punish  gwf_party gwf_military gwf_monarch gwf_democracy , cluster(ccode)
est store m1
pre
fitstat

logit punish  gwf_party gwf_military gwf_monarch gwf_democracy max_purges irr_entry previous_sum_punish instit_control, cluster(ccode)
est store m2
pre
fitstat

logit punish  gwf_party gwf_military gwf_monarch max_purges irr_entry previous_sum_punish instit_control if gwf_democracy==0, cluster(ccode)
est store m3
pre
fitstat

estout m1 m2 m3 using "E:/Mussolini/Results/Table2.txt", style(tex) cells(b(star fmt(2)) se(par fmt(2))) starlevels(+ 0.1 * 0.05 ** 0.01) stats(N ll r2_p, labels("Observations" "Log likelihood" "Pseudo R2")) varl(gwf_party "Single Party" gwf_military "Military Regime" gwf_monarch "Monarch" gwf_democracy "Democracy" dem_successor "Democratic Successor" military_successor "Military Successor" party_successor "Single Party Successor" monarch_successor "Monarch Successor" max_purges "Number of Governmental Purges" max_both_max_pts "Political Terror Scale" irr_entry "Irregular Entry" previous_sum_punish "Number of Previous Leaders Punished" military_exit "Military Overthrow" instit_control "Institutionalized Means of Removal" _cons "Constant") varwidth(30) collabels(" ")

*Table 3 "Logit Models for Negative Fates (Alternative Measures)"

logit punish gwf_party  gwf_military gwf_monarch gwf_democracy pers_hybrid mil_hybrid irr_entry max_purges previous_sum_punish instit_control, cluster(ccode)
est store m4
pre
fitstat

logit punish max_pers_magaloni max_military_scale  gwf_democracy irr_entry  max_purges previous_sum_punish instit_control, cluster(ccode)
est store m5
pre
fitstat

logit punish max_person_scale max_military_scale gwf_democracy irr_entry  max_purges previous_sum_punish instit_control, cluster(ccode)
est store m6
pre
fitstat

logit punish max_person_scale max_military_scale gwf_democracy irr_entry  max_both_max_pts previous_sum_punish instit_control, cluster(ccode)
est store m7
pre
fitstat

estout m4 m5 m6 m7 using "E:/Mussolini/Results/Table3.txt", style(tex) cells(b(star fmt(2)) se(par fmt(2))) starlevels(+ 0.1 * 0.05 ** 0.01) stats(N ll r2_p, labels("Observations" "Log likelihood" "Pseudo R2")) varl(max_person_scale "Personalist Scale" max_military_scale "Militarism Scale" gwf_party "Single Party" gwf_military "Military Regime" gwf_monarch "Monarch" gwf_democracy "Democracy" max_purges "Number of Governmental Purges" max_both_max_pts "Political Terror Scale" irr_entry "Irregular Entry" previous_sum_punish "Number of Previous Leaders Punished" military_exit "Military Overthrow" instit_control "Institutionalized Means of Removal" _cons "Constant") varwidth(30) collabels(" ")

*Substantive effects (within text, associated with Table 3)

logit punish c.max_pers_magaloni c.max_military_scale gwf_democracy irr_entry  c.max_both_max_pts previous_sum_punish c.instit_control, cluster(ccode)
margins, at(max_pers_magaloni=(1(1)2) max_military_scale=0.26 gwf_democracy=0 irr_entry=0 max_both_max_pts=3 instit_control=1 previous_sum_punish=3)

logit punish c.max_person_scale c.max_military_scale gwf_democracy irr_entry  c.max_both_max_pts previous_sum_punish c.instit_control, cluster(ccode)
margins, at(max_person_scale=(0.5(0.5)1) max_military_scale=0.26 gwf_democracy=0 irr_entry=0 max_both_max_pts=3 instit_control=1 previous_sum_punish=3)

*Table 4 "Multinomial Probit Models for Negative Fates"

mprobit posttenurefate max_person_scale max_military_scale  gwf_democracy irr_entry max_purges previous_sum_punish  instit_control, base(0) cluster(ccode)
est store m8

mprobit posttenurefate max_person_scale max_military_scale  gwf_democracy irr_entry max_both_max_pts previous_sum_punish  instit_control, base(0) cluster(ccode)
est store m9

estout m8 m9 using "E:/Mussolini/Results/Table4.txt", style(tex) cells(b(star fmt(2)) se(par fmt(2))) starlevels(+ 0.1 * 0.05 ** 0.01) stats(N ll r2_p, labels("Observations" "Log likelihood" "Pseudo R2")) varl(max_person_scale "Personalist Scale" max_military_scale "Militarism Scale" gwf_party "Single Party" gwf_military "Military Regime" gwf_monarch "Monarch" gwf_democracy "Democracy" max_purges "Number of Governmental Purges" max_both_max_pts "Political Terror Scale" irr_entry "Irregular Entry" previous_sum_punish "Number of Previous Leaders Punished" military_exit "Military Overthrow" instit_control "Institutionalized Means of Removal" _cons "Constant") varwidth(30) collabels(" ")

*Table 5 "Bivariate Probit Models for Negative Fates and Irregular Exit"

biprobit punish irr_exit  max_person_scale max_military_scale gwf_democracy irr_entry  max_purges previous_sum_punish instit_control, cluster(ccode)
est store m10 

biprobit punish irr_exit  max_pers_magaloni max_military_scale gwf_democracy irr_entry  max_purges previous_sum_punish instit_control, cluster(ccode)
est store m11

biprobit punish irr_exit  max_person_scale max_military_scale gwf_democracy  irr_entry  max_both_max_pts previous_sum_punish instit_control, cluster(ccode)
est store m12 

biprobit punish irr_exit  max_pers_magaloni max_military_scale gwf_democracy  irr_entry  max_both_max_pts previous_sum_punish instit_control, cluster(ccode)
est store m13

estout m10 m11 m12 m13 using "E:/Mussolini/Results/Table5.txt", style(tex) cells(b(star fmt(2)) se(par fmt(2))) starlevels(+ 0.1 * 0.05 ** 0.01) stats(N ll r2_p, labels("Observations" "Log likelihood" "Pseudo R2")) varl(gwf_party "Single Party" gwf_military "Military Regime" gwf_monarch "Monarch" gwf_democracy "Democracy" dem_successor "Democratic Successor" military_successor "Military Successor" party_successor "Single Party Successor" monarch_successor "Monarch Successor" max_purges "Number of Governmental Purges" max_both_max_pts "Political Terror Scale" irr_entry "Irregular Entry" previous_sum_punish "Number of Previous Leaders Punished" military_exit "Military Overthrow" instit_control "Institutionalized Means of Removal" _cons "Constant") varwidth(30) collabels(" ")

*************************************************************************************
*FIGURES*
*************************************************************************************

*Figure 1 --SEE EXCEL FILE "FIGURE 1.xls" for production of figure
tab posttenurefate if gwf_democracy==1
tab posttenurefate if gwf_party==1
tab posttenurefate if gwf_military==1
tab posttenurefate if gwf_monarch==1
tab posttenurefate if gwf_personalist==1

*Figure 2 "Probabilities of Negative Fate Relative to Personalist Regime"
logit punish  i.gwf_party i.gwf_military i.gwf_monarch i.gwf_democracy max_purges irr_entry previous_sum_punish instit_control, cluster(ccode)
margins, dydx(gwf_monarch) at(gwf_party=0 gwf_military=0 gwf_democracy=0)
margins, dydx(gwf_military) at(gwf_party=0 gwf_monarch=0 gwf_democracy=0)
margins, dydx(gwf_party) at(gwf_monarch=0 gwf_military=0 gwf_democracy=0)
margins, dydx(gwf_democracy) at(gwf_monarch=0 gwf_military=0 gwf_party=0)

*Personalist Probability
margins, at(gwf_party=0 gwf_military=0 gwf_democracy=0 gwf_monarch=0)

*Graph
sort n 
twoway rcap lo hi n

*Figure 3 "Coefficient Plot of Personalism across Regime Type"

logit punish max_person_scale  if regime==2, cluster(ccode)
estimates store SinglePartyRegimes

logit punish max_person_scale if regime==4, cluster(ccode)
estimates store MilitaryRegimes

logit punish max_person_scale if regime==5, cluster(ccode)
estimates store Democracies

logit punish max_person_scale irr_entry  max_both_max_pts previous_sum_punish instit_control if regime==2, cluster(ccode)
estimates store SinglePartyRegimes2

logit punish max_person_scale irr_entry  max_both_max_pts previous_sum_punish instit_control if regime==4, cluster(ccode)
estimates store MilitaryRegimes2

logit punish max_person_scale irr_entry  max_both_max_pts previous_sum_punish instit_control if regime==5, cluster(ccode)
estimates store Democracies2

coefplot (SinglePartyRegimes \ MilitaryRegimes  \ Democracies \ SinglePartyRegimes2 \ MilitaryRegimes2  \ Democracies2), drop(_cons irr_entry  max_both_max_pts previous_sum_punish instit_control) aseq swapnames 


